package com.springboot.demo.entity;

import com.springboot.demo.entity.validate.scene.*;
import com.springboot.demo.entity.validate.user.IdGroup;
import com.springboot.demo.entity.validate.user.UsernameGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;
import java.util.List;

/**
 * @author wubc683
 * @desc
 * @date 2021-07-26 14:17
 */
@Data
@ApiModel
public class SceneGroup {
    @ApiModelProperty(value = "组态文件夹id", required = true)
    @NotNull(message = "组态文件夹id不能为空", groups = IdGroup.class)
    private Long id;
    @ApiModelProperty(value = "组态文件夹的上层文件夹id,0表示文件夹是顶层", required = true)
    @NotNull(message = "组态文件夹id不能为空", groups = IdGroup.class)
    private Long parentId;
    @ApiModelProperty(value = "组态文件夹名,5~31字符", required = true)
    @NotBlank(message = "组态文件夹名不能为空", groups = SceneFolderNameGroup.class)
//    @Pattern(regexp = "^[\\S]{5,32}$", message = "组态文件夹名格式错误", groups = SceneFolderNameGroup.class)
    @Pattern(regexp = "^[\\u4E00-\\u9FA5a-zA-Z0-9_-]{6,32}$", message = "组态文件夹格式错误" ,groups =
            SceneFolderNameGroup.class)
    private String name;
    @ApiModelProperty(value = "组态文件夹所有者id")
    private Long ownerId;
    @ApiModelProperty(value = "组态文件夹层级")
    private Integer rank;
    @ApiModelProperty("直属子文件夹")
    private List<SceneGroup> sceneGroups;
    @ApiModelProperty("组态文件夹下组态列表,不包含子文件夹下")
    private List<Scene> scenes;
}
